﻿/**
 * @copyright Copyright 2009 Structured Solutions
 * @license http://www.codeplex.com/ShippingAgent/license Microsoft Public License (Ms-PL)
 * @version 3.3
 */

using System.Configuration;

namespace StructuredSolutions.ShippingAgent
{
    public class ShippingAgentSection : ConfigurationSection
    {
        [ConfigurationProperty("ignoreInventorySystem", DefaultValue = false, IsRequired = false)]
        public bool IgnoreInventorySystem
        {
            get { return (bool)this["ignoreInventorySystem"]; }
            set { this["ignoreInventorySystem"] = value; }
        }

        [ConfigurationProperty("lineItemProperties")]
        public LineItemPropertiesElement LineItemProperties
        {
            get { return (LineItemPropertiesElement) this["lineItemProperties"]; }
            set { this["lineItemProperties"] = value; }
        }

        [ConfigurationProperty("orderAddressProperties")]
        public OrderAddressPropertiesElement OrderAddressProperties
        {
            get { return (OrderAddressPropertiesElement) this["orderAddressProperties"]; }
            set { this["orderAddressProperties"] = value; }
        }

        [ConfigurationProperty("orderPaymentStatuses")]
        public OrderPaymentStatusesElement OrderPaymentStatuses
        {
            get { return (OrderPaymentStatusesElement) this["orderPaymentStatuses"]; }
            set { this["orderPaymentStatuses"] = value; }
        }

        [ConfigurationProperty("orderShipmentStatuses")]
        public OrderShipmentStatusesElement OrderShipmentStatuses
        {
            get { return (OrderShipmentStatusesElement)this["orderShipmentStatuses"]; }
            set { this["orderShipmentStatuses"] = value; }
        }

        [ConfigurationProperty("paymentStatuses")]
        public PaymentStatusesElement PaymentStatuses
        {
            get { return (PaymentStatusesElement)this["paymentStatuses"]; }
            set { this["paymentStatuses"] = value; }
        }

        [ConfigurationProperty("shipmentProperties")]
        public ShipmentPropertiesElement ShipmentProperties
        {
            get { return (ShipmentPropertiesElement) this["shipmentProperties"]; }
            set { this["shipmentProperties"] = value; }
        }

        [ConfigurationProperty("shipmentStatuses")]
        public ShipmentStatusesElement ShipmentStatuses
        {
            get { return (ShipmentStatusesElement)this["shipmentStatuses"]; }
            set { this["shipmentStatuses"] = value; }
        }

        [ConfigurationProperty("siteName", DefaultValue = "Default", IsRequired = true)]
        [StringValidator(MinLength = 1)]
        public string SiteName
        {
            get { return (string)this["siteName"]; }
            set { this["siteName"] = value; }
        }

        public class LineItemPropertiesElement : ConfigurationElement
        {
            [ConfigurationProperty("shippable", DefaultValue = "Shippable")]
            public string Shippable
            {
                get { return (string) this["shippable"]; }
                set { this["shippable"] = value; }
            }

            [ConfigurationProperty("weight", DefaultValue = "Weight")]
            public string Weight
            {
                get { return (string)this["weight"]; }
                set { this["weight"] = value; }
            }
        }

        public class OrderAddressPropertiesElement : ConfigurationElement
        {
            [ConfigurationProperty("residential", DefaultValue = "Residential")]
            public string Residential
            {
                get { return (string)this["residential"]; }
                set { this["residential"] = value; }
            }
        }

        public class OrderPaymentStatusesElement : ConfigurationElement
        {
            [ConfigurationProperty("fullyPaid", DefaultValue = "Paid")]
            public string FullyPaid
            {
                get { return (string) this["fullyPaid"]; }
                set { this["fullyPaid"] = value; }
            }

            [ConfigurationProperty("overPaid", DefaultValue = "Over Paid")]
            public string OverPaid
            {
                get { return (string) this["overPaid"]; }
                set { this["overPaid"] = value; }
            }

            [ConfigurationProperty("partiallyPaid", DefaultValue = "Partially Paid")]
            public string PartiallyPaid
            {
                get { return (string)this["partiallyPaid"]; }
                set { this["partiallyPaid"] = value; }
            }

            [ConfigurationProperty("unknown", DefaultValue = "Unknown")]
            public string Unknown
            {
                get { return (string)this["unknown"]; }
                set { this["unknown"] = value; }
            }

            [ConfigurationProperty("unpaid", DefaultValue = "Unpaid")]
            public string Unpaid
            {
                get { return (string)this["unpaid"]; }
                set { this["unpaid"] = value; }
            }
        }

        public class OrderShipmentStatusesElement : ConfigurationElement
        {
            [ConfigurationProperty("fullyShipped", DefaultValue = "Shipped")]
            public string FullyShipped
            {
                get { return (string)this["fullyShipped"]; }
                set { this["fullyShipped"] = value; }
            }

            [ConfigurationProperty("partiallyShipped", DefaultValue = "Partially Shipped")]
            public string PartiallyShipped
            {
                get { return (string)this["partiallyShipped"]; }
                set { this["partiallyShipped"] = value; }
            }

            [ConfigurationProperty("unknown", DefaultValue = "Unknown")]
            public string Unknown
            {
                get { return (string)this["unknown"]; }
                set { this["unknown"] = value; }
            }

            [ConfigurationProperty("unshipped", DefaultValue = "Unshipped")]
            public string Unshipped
            {
                get { return (string)this["unshipped"]; }
                set { this["unshipped"] = value; }
            }
        }

        public class PaymentStatusesElement : ConfigurationElement
        {
            [ConfigurationProperty("paid", DefaultValue = "Paid")]
            public string Paid
            {
                get { return (string) this["paid"]; }
                set { this["paid"] = value; }
            }

            [ConfigurationProperty("unknown", DefaultValue = "Unknown")]
            public string Unknown
            {
                get { return (string)this["unknown"]; }
                set { this["unknown"] = value; }
            }
        }

        public class ShipmentPropertiesElement : ConfigurationElement
        {
            [ConfigurationProperty("height", DefaultValue = "Height")]
            public string Height
            {
                get { return (string)this["height"]; }
                set { this["height"] = value; }
            }
            
            [ConfigurationProperty("length", DefaultValue = "Length")]
            public string Length
            {
                get { return (string)this["length"]; }
                set { this["length"] = value; }
            }

            [ConfigurationProperty("shipDate", DefaultValue = "ShipDate")]
            public string ShipDate
            {
                get { return (string) this["shipDate"]; }
                set { this["shipDate"] = value; }
            }
            
            [ConfigurationProperty("weight", DefaultValue = "Weight")]
            public string Weight
            {
                get { return (string)this["weight"]; }
                set { this["weight"] = value; }
            }

            [ConfigurationProperty("width", DefaultValue = "Width")]
            public string Width
            {
                get { return (string)this["width"]; }
                set { this["width"] = value; }
            }
        }

        public class ShipmentStatusesElement : ConfigurationElement
        {
            [ConfigurationProperty("shipped", DefaultValue = "Shipped")]
            public string Shipped
            {
                get { return (string)this["shipped"]; }
                set { this["shipped"] = value; }
            }

            [ConfigurationProperty("unknown", DefaultValue = "Unknown")]
            public string Unknown
            {
                get { return (string) this["unknown"]; }
                set { this["unknown"] = value; }
            }

            [ConfigurationProperty("unshipped", DefaultValue = "Unshipped")]
            public string Unshipped
            {
                get { return (string)this["unshipped"]; }
                set { this["unshipped"] = value; }
            }
        }
    }
}